<template>

  <div class="title">

    <div class="return" @click="goBack()">

      <i class="el-icon-arrow-left return_icon" />
      返回

    </div>

    <div class="select">
      <el-select v-model="value" class="m_select" placeholder="请选择" @change="change">
        <el-option
          v-for="item in navBarList"
          :key="item.value"
          :label="item.menuCname"
          :value="item.menuEname"
        />
      </el-select>
    </div>

  </div>

</template>

<script>

export default {
  props: {

  },
  data() {
    return {
      navBarList: [],
      value: '管理下属"一人一表"'
    }
  },
  mounted() {
    this.init()
  },
  methods: {
    init() {
      this.$http.post('/serviceAction/common', {
        'serviceName': 'MT01001',
        'methodName': 'getNavForParent',
        'parentNav': 'MT20000'
      }).then((res) => {
        // console.log(res)
        if (res.isSuccess) {
          this.navBarList = res.data.navBarList
        }
      })
    },
    change(val) {
      console.log(val)
      this.$parent.tabClick(val)
      // if (val === 'MT12000') {
      //   this.$router.push({
      //     path: '/viewIndex',
      //     query: {
      //     // edit: '1'
      //     }
      //   })
      // } else {
      //   this.$router.push({
      //     path: '/mainTask',
      //     query: {
      //       edit: '1'
      //     }
      //   })
      // }
    },
    goBack() {
      console.log(this.$route.path)
      if (this.$route.path === '/reviewIndex') {
        this.$confirm(`您的操作已保存，但尚未完成审核，是否确认离开此页面？`, {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$router.go(-1)
        }).catch(() => {

        })
      } else {
        this.$router.go(-1)
      }
    }
  }
}

</script>

<style scoped lang="scss">
.title{
    font-size: 12px;
     height:60px;
     line-height: 60px;
     background: #F0F0F0;
    .select{
        float: left;
    }
    .return{
        margin-right:20px;
        font-size: 14px;
        padding-left:20px;
        float: left;
        cursor: pointer;
        .return_icon{
            font-weight: 600;
        }
    }
}
::v-deep{
    .m_select{
        .el-input{
            position: relative;
            height:40px;
        }
    }
}

</style>>
